﻿<Window x:Class="HRM.View.Login"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{StaticResource Title}" Height="300" Width="300"
        DataContext="{Binding Login, Source={StaticResource Locator}}"
        xmlns:local="clr-namespace:HRM.CustomControl"
        >
    <Window.Resources>
        <Style x:Key="TextBlockStyle" TargetType="TextBlock">
            <Setter Property="FontSize" Value="14" />
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
        
    </Window.Resources>
    <Grid>
        <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Height="Auto">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="30"/>
                <RowDefinition />
                <RowDefinition Height="10"/>
                <RowDefinition />
                <RowDefinition Height="20"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="10"/>
                <ColumnDefinition Width="120"/>
            </Grid.ColumnDefinitions>

            <TextBlock Text="Đăng nhập" Grid.Row="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" FontSize="36" FontFamily="Myriad Pro" Foreground="#FFDC3131" Margin="0" />
            <TextBlock Text="Tên đăng nhập" Grid.Row="2" Grid.Column="0" Style="{StaticResource TextBlockStyle}"/>
            <TextBlock Text="Mật khẩu" Grid.Row="4" Grid.Column="0" Style="{StaticResource TextBlockStyle}"/>
            <TextBox Grid.Row="2" Grid.Column="4" Text="{Binding UserName, Mode=TwoWay}" Height="24" VerticalContentAlignment="Center"/>
            <PasswordBox Grid.Row="4" Grid.Column="3" Height="24" x:Name="Password" VerticalContentAlignment="Center">
                <PasswordBox.InputBindings>
                    <KeyBinding Key="Enter" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=Password, UpdateSourceTrigger=PropertyChanged}" />
                </PasswordBox.InputBindings>
            </PasswordBox>
            <Button Grid.Row="6" Grid.ColumnSpan="3" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=Password, UpdateSourceTrigger=PropertyChanged}" Content="Login" Height="24" />
        </Grid>

        <Grid Visibility="{Binding Loading, Converter={StaticResource ConvertBooleanToVisibility}}">
            <Grid.Background>
                <SolidColorBrush Color="White" Opacity="0.8"/>
            </Grid.Background>
            <local:LoadingControl HorizontalAlignment="Center" VerticalAlignment="Center"/>
        </Grid>

    </Grid>
</Window>
